using System.Collections.Generic;
using Headsight.BPMN2WF.BPMN.Model;
using Headsight.BPMN2WF.Testing.TestObjCtors;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Headsight.BPMN2WF.Testing.TestObjCtorsTest
{
    [TestClass]
    public class BPMNModelFactoryParamsCtorTest
    {
        private BPMNModelFactoryParamsCtor _sut;

        [TestInitialize]
        public void SetUp()
        {
            _sut = new BPMNModelFactoryParamsCtor();
        }

        [TestMethod]
        public void Create()
        {
            var result = _sut.Create();

            Assert.IsNotNull(result);

            Assert.IsNotNull(result.BpmnModelFactory);
            Assert.IsNotNull(result.BpmnModelFactoryBpmnFlowNode);
            Assert.IsNotNull(result.BpmnModelFactoryBpmnSequenceFlow);
        }

        [TestMethod]
        public void WithBPMNProcessArguments_is_chaining()
        {
            Assert.AreSame(_sut, _sut.WithBPMNProcessArguments(new List<BPMNArgument>()));
        }

        [TestMethod]
        public void WithBPMNProcessArguments_Create()
        {
            var bpmnParams = new List<BPMNArgument>();
            var actual = _sut.WithBPMNProcessArguments(bpmnParams).Create();

            Assert.AreSame(bpmnParams, actual.BpmnModelFactory.CreateArguments(null, null, null));
            Assert.AreSame(bpmnParams, actual.BpmnModelFactory.CreateArgumentsIn(null));
            Assert.AreSame(bpmnParams, actual.BpmnModelFactory.CreateArgumentsOut(null));
        }

        [TestMethod]
        public void WithBPMNFlowNodes_is_chaining()
        {
            Assert.AreSame(_sut, _sut.WithBPMNFlowNodes(new List<BPMNFlowNode>()));
        }

        [TestMethod]
        public void WithBPMNFlowNodes_Create()
        {
            var bpmnFlowNodes = new List<BPMNFlowNode>();
            var actual = _sut.WithBPMNFlowNodes(bpmnFlowNodes).Create();

            Assert.AreSame(bpmnFlowNodes, actual.BpmnModelFactoryBpmnFlowNode.CreateBPMNFlowNodes(null, null, null));
        }

        [TestMethod]
        public void WithBPMNSequenceFlows_is_chaining()
        {
            Assert.AreSame(_sut, _sut.WithBPMNSequenceFlows(new List<BPMNSequenceFlow>()));
        }

        [TestMethod]
        public void WithBPMNSequenceFlows_Create()
        {
            var bpmnSeqFlows = new List<BPMNSequenceFlow>();
            var actual = _sut.WithBPMNSequenceFlows(bpmnSeqFlows).Create();

            Assert.AreSame(bpmnSeqFlows, actual.BpmnModelFactoryBpmnSequenceFlow.CreateBPMNSequenceFlows(null, null));
        }

        [TestMethod]
        public void With_BPMNModelFactoryBPMNArgument_is_chaining()
        {
            Assert.AreSame(_sut, _sut.With(new BPMNModelFactoryBPMNArgumentCtor().Create()));
        }

        [TestMethod]
        public void With_BPMNModelFactoryBPMNArgument_Create()
        {
            var bpmnModelFactoryBpmnArgument = new BPMNModelFactoryBPMNArgumentCtor().Create();
            
            var actual = _sut.With(bpmnModelFactoryBpmnArgument).Create();

            Assert.AreSame(bpmnModelFactoryBpmnArgument, actual.BpmnModelFactory);
        }
    }
}